package com.hy.net.net

import com.hy.net.error.DefaultExceptionHandler
import com.hy.net.flow.requestFlow
import com.hy.net.response.BaseResponse

/**
 * @Description:
 * @Author: wdk
 * @CreateTime: 2024/6/2 15:28
 */
suspend fun <T> requestWanAndroid(
    errorBlock: ((Int?, String?, BaseResponse<T>?) -> Unit)? = null,
    requestCall: suspend () -> BaseResponse<T>?,
    showLoading: ((Boolean) -> Unit)? = null
): T? {
    return requestFlow(
        errorBlock = errorBlock,
        exceptionHandler = DefaultExceptionHandler,
        requestCall = requestCall,
        showLoading = showLoading,
        flowTimeOut = 10 * 1000
    )
}